package com.lb.trac.controller.common.loaders;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.lb.trac.pojo.Utenti;
import com.lb.trac.service.SearchService;

public class LoadUtenteLoggato implements HttpObjectsLoader {

	private SearchService searchService;

	public void load(HttpServletRequest request, HttpServletResponse response) {
		Utenti uv = (Utenti) request.getSession().getAttribute(
				"loginForm");
		if (uv != null) {
			Utenti user = searchService.findUtenteById(uv.getIdUtente().toString());
			request.getSession().setAttribute("loginForm", user);
		}
	}

	public SearchService getSearchService() {
		return searchService;
	}

	public void setSearchService(SearchService searchService) {
		this.searchService = searchService;
	}

}
